package leetcode.L1000;
//桶思想

import java.util.Arrays;

public class EX621 {
    public static void main(String[] args) {
        char[] task = {'A','A','A','B','B','B'};
        int n =2;


        int [] bucket = new int[26];

        for (int i = 0; i < task.length; i++) {
            bucket[task[i]-'A'] ++;
        }
        Arrays.sort(bucket);
        int max = bucket[25];
        int kinds = 0;
        int res = 0;
        for (int i = 25; i >=0&&bucket[i]==max ; i--) {
            kinds++;
        }

        res = (max-1)*(n+1)+kinds ;

        res = task.length<res?task.length:res;


    }

}
